home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / GoodBye / JohnKennedy / July95.lha / masterclass.doc < prev    next >
Encoding:
Text File  |  1995-06-09  |  8.6 KB  |  273 lines

  1. Masterclass
  2.  
  3.  
  4. Keep you Amiga waiting about and make you life easier.
  5.  
  6. Recently I found myself in the situation where I really
  7. needed to start a program running on my Amiga even though I
  8. wasn't about. I was re-rendering a large animation which I
  9. can created with Imagine using AdPro and Fred (a must
  10. under-used system if ever there was one), and when it was
  11. finished I need to combine the results into a ANIM7 file.
  12.  
  13. If you remember, ANIM7 files are like normal Amiga IFF
  14. animations except they are a lot faster if you have a 68020
  15. or better. The excellent Viewtek program comes with the
  16. utility MakeAnim7 which will happily take a standard file
  17. and process it into ANIM7 format. Anyway, the AdPro/Fred
  18. process was still churning away making 24 bit frames into
  19. HAM8 frames and doing a little post-production, and I had to
  20. nip home for tea. I knew the process would finish in an hour
  21. or so, but I couldn't wait around to start the MakeAnim7
  22. program. And although the Amiga is multitasking, I couldn't
  23. start the MakeAnim7 going because it needed to use the files
  24. which wouldn't exist until the AdPro/Fred process was
  25. complete.
  26.  
  27. I needed a way of delaying starting the MakeAnim7 program
  28. for a few hours, so that when I came in to the office next
  29. morning the files would be waiting for me.
  30.  
  31. That's when I remember the AmigaDOS "wait" command. Wait
  32. does exactly what you would expect it to: nothing. It simply
  33. sits there doing nothing (not wasting processor power) until
  34. it gets bored. You can therefore use it to delay a process
  35. for starting. Open a Shell and enter:
  36.  
  37. wait 10 secs
  38.  
  39. and you'll see that wait well, waits. You can also use the
  40. following format
  41.  
  42. wait 1 min 10 secs
  43.  
  44. for waiting longer times.
  45.  
  46. Therefore, you could write a script which looked like the
  47. following. Remember a script is nothing more complicated
  48. than a text file, created with ED or some other text editor.
  49.  
  50. wait 120 min
  51. makeanim7 hd3:house.anim
  52.  
  53.  
  54. Now with this script saved to disk under the name "Zzz" I
  55. could open a shell and enter:
  56.  
  57. execute Zzz
  58.  
  59. and then nip home for tea. When two hours had passed the
  60. script would move unto the MakeAnim7 part, by which time
  61. AdPro/Fred would be finished.
  62.  
  63. You can also ask wait to keep waiting until a specific time.
  64. For example, enter "date" into the shell and make a note of
  65. the time. Quickly add a few seconds and enter:
  66.  
  67. wait until 16:12
  68.  
  69. or whatever the time is. The process will freeze until the
  70. time passes. Note that this is startlingly accurate, but it
  71. is certainly good enough for simply delaying the process.
  72.  
  73. This got me thinking, because sometimes I get a bit wary
  74. about leaving the Amiga working all night on something
  75. important. If something has gone wrong, I would like to know
  76. about it. The problem is that the Amiga is in an office
  77. several miles away, and I don't want to keep driving there
  78. to look through the window.
  79.  
  80. Well, thanks to modern technology I don't have to any more.
  81. My Amiga happens to have a modem attached to it, and by
  82. using ARexx to control a comms program, I can write a
  83. program which actually dials up my home number. Now you need
  84. to be really careful debugging programs like this: and one
  85. of the first things to check is that it will dial the right
  86. number every single time. The second thing is to check that
  87. the modem will be correctly disconnected without leaving the
  88. line off the hook.
  89.  
  90. The set-up is something like this: an AmigaDOS script waits
  91. until a certain time. It then runs an ARexx program. The
  92. ARexx program does a little work to calculate the last image
  93. rendered, or how much free disk space is free: something
  94. that lets me know all is OK. It then uses the ARexx port on
  95. the terminal emulator program "Term", and instructs it to
  96. dial my house. The script checks for an engaged tone, and
  97. also checks that the line doesn't keep ringing indefinitely.
  98.  
  99. This is where things start to go wrong however, as try as I
  100. might, I really can't understand a modem talking to me at
  101. V34 28,800 bps. The original plan was to connect some form
  102. of speech synthesiser, perhaps using the old Workbench 1.3
  103. Amiga SAY command. This could therefore ring me up at 10
  104. o'clock in the evening and say "Hello master, last frame
  105. rendered was 1040". It could also ring me up first thing in
  106. the morning and tell me to get out of bed.
  107.  
  108. However, connecting a speed synthesiser to the modem is
  109. starting to get a bit tricky. Instead the modem dials my
  110. number and lets it ring only once. This lets me know that
  111. the next call is from the computer, and I shouldn't answer
  112. it. The program then redials me, and depending on the number
  113. of rings informs me of the current status. Three rings means
  114. everything is ok, six means something is wrong. Get the
  115. idea. Best of all, as I don't answer the call I finally get
  116. to use BT's service for free.
  117.  
  118.  
  119. The script used to dial up my number looks something like
  120. this:
  121.  
  122.  
  123.  
  124. /* Dial me up! */
  125.  
  126. address term
  127. OPTIONS RESULTS
  128. Say "Wake up modem..."
  129. send 'atz\r\n'
  130. wait 'OK'
  131. say "Dialing..."
  132. send "atdt<my number hear>\r"
  133.  
  134. TIMEOUT SEC 20
  135.  
  136. CLEAR wait
  137. ADDITEM TO wait NAME 'BUSY'
  138. ADDITEM TO wait NAME 'RINGING'
  139.  
  140. wait
  141.  
  142. IF rc ~= 0 THEN
  143.              SAY 'no text was received from modem'
  144.           ELSE
  145.             do
  146.              SAY result
  147.              say "I know the telephone is ringing or busy"
  148.             end
  149.  
  150. if result = 'BUSY' then
  151.             do
  152.                 say "The line is busy, so exit."
  153.                 hangup
  154.                 exit
  155.             end
  156.  
  157. if result = 'RINGING' then say "I know it is ringing.."
  158.  
  159. /* We can tell if the call is answered only if the
  160.    RINGING signal does not happen again with a few seconds...
  161. */
  162.  
  163. max_rings = 3
  164. rings=0
  165. do while (rc=0 & rings<max_rings)
  166.     TIMEOUT SEC 5
  167.     CLEAR wait
  168.     ADDITEM TO wait NAME 'RINGING'
  169.     wait
  170.     SAY 'Still ringing..'
  171.     rings=rings+1
  172.     say rc
  173.     say result
  174.     say rings
  175. end
  176.  
  177.  
  178. if rings=max_rings then
  179.     do
  180.         say "Too long... no-one is at home!"
  181.         say "I'm hanging up..." 
  182.         send 'atz\r'
  183.         exit
  184.     end
  185.         
  186.  
  187. /* Hurrah! At last! */
  188.  
  189. SAY "The telephone has been answered!"
  190. delay 1
  191. say "I'm talking to me.."
  192. /* Add speech synth stuff here */
  193. delay 1
  194. say "Blah blah blah"
  195. delay 1
  196. say "Goodbye, Hanging up..."    
  197.  
  198. send 'atz\r'
  199. /* Make sure... */
  200. delay 1
  201. send 'atz\r'
  202.  
  203. /* end */
  204.  
  205.  
  206.  
  207. The bit about not being able to connect the speech
  208. synthesiser is irritating me, so I'm trying to track down a
  209. GVP PhonePak. The PhonePak was a remarkable ZorroII card that
  210. never got the attention it deserved. Even today, the
  211. telecoms industry is only just starting to catching up with
  212. this incredible card. The PhonePak could answer telephone
  213. calls, and store incoming messages on hard disk. It could
  214. even understand pulse dialing codes which meant it was fully
  215. interactive. With a built-in Fax machine and ARexx port
  216. there was little the PhonePak couldn't do.
  217.  
  218. However, in the meantime, why not have a go at trying to
  219. automate some of your Amiga processes. If you are a Point
  220. off a BBS, you could use Wait to poll your BOSS whilst still
  221. in the BT cheap rate every morning.
  222.  
  223. Keep a look out for a program called CyberCron as well. This
  224. utility is specially designed to run in the background, and
  225. keeps a list of tasks it has to launch at certain times of
  226. the day.
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235. Box out: Pretty Workbench Displays
  236.  
  237. If you remember, a month or two ago I made a plea to banish
  238. forever the blue and greys of the standard Amiga Workbench.
  239. Thankfully, at lease one person heard me and Tom Pereira has
  240. sent in two examples of what your workbench could look like
  241. if you spent a bit of time re-designing it. I can recognise
  242. a lot of Tom's icons as available from PD libraries and from
  243. the Aminet collection, so don't think that you'll need to
  244. design the entire collection from scratch yourself.
  245.  
  246. Designing your new Workbench display can be tricky. You need
  247. to balance the need for more colours, with the amount of
  248. memory they consume: especially true if you are using
  249. hi-resolution screens such as dblPAL or Multiscan
  250. Productivity. You will also find that the more bitplanes you
  251. use, the slower everything goes.
  252.  
  253. One option, not available to all, is to fit a graphics card
  254. such as a PicassoII, SD64 or CyberVision. These cards remove
  255. the need for the Amiga display to be held in Chip Ram, and
  256. are designed to work in 256 colour modes very quickly
  257. indeed. Unfortunately, you'll need an Amiga with Zorro
  258. expansion slots and a spare £300 to take up this option.
  259.  
  260. So, thanks to Tom for his work, and if you have a workbench
  261. you feel could be a inspiration to others, please send in an
  262. IFF.
  263.  
  264.  
  265. Image: MyWorkbench1.iff
  266. Image: Flowery.iff (please use this image smaller as it
  267. isn't as important as MyWorkBench1.iff)
  268. Caption: Tom Pereira's Workbench uses lots of colour and a
  269. cheeky backdrop to annoy passing PC owners. The Flowery
  270. Bench is presumably an option for fans of very unattractive
  271. wallpaper.
  272.  
  273.